<!--河南星辰软件科技有限公司
@copyright Copyright (c) 2010~2022 All rights reserved.
-->
<template>
  <div>
    <el-form ref="form" :model="s_product" :rules="rules" label-width="100px" id="mvcfm">
      <div class="form-unit">
        <span class="mvc-title-left"> 产品 </span>
      </div>
      <el-table :data="s_product">
        <el-table-column label="产品条形码" prop="product_barcode">
        </el-table-column>
        <el-table-column label="产品名称" prop="product_name">
        </el-table-column>
        <el-table-column label="产品型号" prop="product_model">
        </el-table-column>
        <el-table-column label="产品规格" prop="product_norm">
        </el-table-column>
        <el-table-column label="建议价" prop="product_price">
        </el-table-column>
        <el-table-column label="补充" prop="product_des">
        </el-table-column>
        <el-table-column label="简要描述" prop="">
          <template slot-scope="scope">
            <el-input v-model="scope.row.pronum_remark" />
          </template>
        </el-table-column>
        <el-table-column label="数量" prop="">
          <template slot-scope="scope">
            <el-input v-model="scope.row.pronum_no" />
          </template>
        </el-table-column>
        <el-table-column label="单价" prop="price_pro">
          <template slot-scope="scope">
            <el-input v-model="scope.row.price_pro" />
          </template>
        </el-table-column>
        <el-table-column label="交货地点" prop="" width="50">
          <template slot-scope="scope">
            <el-input v-model="scope.row.pronum_address" />
          </template>
        </el-table-column>
        <el-table-column label="交货时间" prop="">
          <template slot-scope="scope">
            <el-date-picker v-model="scope.row.pronum_endate" type="date" style='width:100%' value-format="yyyy-MM-dd" />
          </template>
        </el-table-column>
      </el-table>
      <el-button @click="productSelectionSubmit('&category_id=')" type='success' size="mini"><i class='fa fa-check'></i>确认</el-button>
    </el-form>
  </div>
</template>
<script>
  import request from '@/utils/request'
  export default {
    name: 'ProductSelection',
    components: {},
    props: ['popparams'],
    data() {
      return {
        vueparams: this.getVUEParams(""),
        s_product: [],
        s_tree_menu: [],
        loading: false,
        rules: {}
      }
    },
    created() {
      this.getData();
    },
    updated() {},
    mounted() {},
    methods: {
      getData() {
        request({
          method: 'get',
          url: '/xcapi/VUEAction/psi/supplychainmana/ProcureSupplyAction/productSelection?' + this.vueparams,
        }).then(data => {
          for (var k in data) {
            if (Array.isArray(data[k])) {
              this[k] = data[k];
            } else {
              $.extend(this[k], data[k]);
            }
          }
        })
      },
      productSelectionSubmit(_params) {
        this.$refs["form"].validate(valid => {
          if (valid) {
            request({
              method: 'post',
              url: '/xcapi/VUEAction/psi/supplychainmana/ProcureSupplyAction/productSelectionSubmit?' + _params + this.vueparams,
              data: this.postData()
            }).then(data => {
              this.$router.replace("/redirect" + this.$route.fullPath);
              this.msgSuccess(data.msg);
            })
          } else {
            this.msgError("必填项错误");
          }
        });
      },
      handleOutline(data) {
        request({
          method: 'get',
          url: '/xcapi/VUEAction/psi/supplychainmana/ProcureSupplyAction/s_tree_menu?' + this.vueparams,
        }).then(data => {
          this.s_tree_menu = data.s_tree_menu;
          this.s_tree_menu = this.s_tree_menu.reverse();
        })
      },
    },
  }
</script>
